flag = true
function FocusItem(obj){
    $(obj).next('span').html('').remove('error');
}

function CheckItem(obj){
    var ct = /^(19|20)\d{2}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])\s([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/
    var msgBox = $(obj).next('span')
    if(obj.value == ""){
        msgBox.html("上架时间不能为空");
        msgBox.addClass('error');
        flag = false
    }else if(!ct.test(obj.value)){
        msgBox.html('时间格式不正确');
        msgBox.addClass('error');
        flag = false
    }else{
        msgBox.html().removeClass('error');
        flag = true
    }
}

function checkForm(form) {
    var all = form.getElementsByTagName('input');
    for (var i = 0;i<all.length;i++){
        var obj = all[i];
        if (obj != null){
            if (obj.getAttribute("onblur")){
                CheckItem(all[i]);
            }
        }
    }
    return flag;
}